package cn.org.dian.easycommunicate.util;

import com.google.api.translate.Language;


/**
 * Constants used by the app.
 * @author LiuGen
 * @date 2011-1-21
 */
public class Constants {

    public static final int ENGLISH_INDICATOR = 0;
    public static final int FRENCH_INDICATOR = 1;
    public static final int GERMAN_INDICATOR = 2;
    public static final int ITALIAN_INDICATOR = 3;
    public static final int SPANISH_INDICATOR = 4;
    
    public static final String DEFAULT_TAG = "EasyComm";
    
    /**
     * used for shared pref
     */
    public static final String PREF_NAME = "cn.org.dian.easycommunicate_preferences";
    
    public static final String PREF_KEY_MOBILE_NETWORK_STATS = "mobile_network_stats";
    
    public static final String PREF_KEY_SHOW_MOBILE_NETWORK_STATS = "show_mobile_network_stats";
    public static final String PREF_KEY_SHOW_CLEAR_STAT = "show_clear_stats";
    
    
    public static final Integer FILE_NAME_LENGTH_MAX = 255;
    
    
    
    /**
     * 
     * @param languageIndicator
     * @return null if not match
     */
    public static Language languageIndicatorToEnum(int languageIndicator) {
    	if(Utilities.isCurrentLanEng()) {
    		languageIndicator++;
    	}
        switch (languageIndicator) {
        case ENGLISH_INDICATOR:
            return Language.ENGLISH;
        case FRENCH_INDICATOR:
            return Language.FRENCH;
        case GERMAN_INDICATOR:
            return Language.GERMAN;
        case ITALIAN_INDICATOR:
            return Language.ITALIAN;
        case SPANISH_INDICATOR:
            return Language.SPANISH;
        default:
            return null;
        }
    }
    
    /**
     * 
     * @param language
     * @return null if not match
     */
    public static Integer enumToLanguageIndicator(Language language) {
        if (language.equals(Language.ENGLISH)) {
            return ENGLISH_INDICATOR;
        } else if (language.equals(Language.FRENCH)) {
            return FRENCH_INDICATOR;
        } else if (language.equals(Language.GERMAN)) {
            return GERMAN_INDICATOR;
        } else if (language.equals(Language.ITALIAN)) {
            return ITALIAN_INDICATOR;
        } else if (language.equals(Language.SPANISH)) {
            return SPANISH_INDICATOR;
        } else {
            return null;
        }
    }
   
}
